home *** CD-ROM | disk | FTP | other *** search
Wrap
/* $Id: I3DExMdr.h 1.16 1997/06/30 18:51:11 YannPC Exp $ */ /*****************************************************************************\ * * * I3DExMdr.h * * I3DExModeler definition * * I3DExModelerOperation definition * * * * External modelers interface * * External commands for external modelers interface * * * * Copyright (c) 1996, Fractal Design Corp. All rights reserved. * * * \*****************************************************************************/ #ifndef __I3DEXMDR__ #define __I3DEXMDR__ #ifndef __I3DEXMDU__ #include "I3DExMdu.h" #endif //****** Globally Unique Ids ************************************************** DEFINE_GUID(IID_I3DExModeler, 0x4656c080, 0xba0f, 0x11cf, 0x99, 0x09, 0x00, 0x40, 0x05, 0x22, 0xbf, 0xcc); DEFINE_GUID(IID_I3DExModelerOperation, 0x47fa5e60, 0xba0f, 0x11cf, 0x99, 0x09, 0x00, 0x40, 0x05, 0x22, 0xbf, 0xcc); struct I3DExModelerOperation; /*****************************************************************************\ * Important note about the 'Modu' resource: * * For External Modelers, the value of the 'Workspace class signature' field * MUST be 'PeRs'. * \*****************************************************************************/ /*****************************************************************************\ * Private data of the Modeler (stored in the Cmpp resource of same ID). * * * * Theory: * * * * The Cmpp resource contains data for the Shell, so the Shell can learn * * which type of Primitive(s) the Modeler can edit directly or indirectly. * * * \*****************************************************************************/ // Used in SExModelerData: typedef struct { long fPrimitiveID; // Primitive Class ID that the modeler can edit long fNative; // If TRUE, then the modeler knows how to modify the primitive's data in place. // In this case, the pointer received in Edit() will be a pointer on the primtive. // If FALSE, then an empty primitive of the first 'native' type will be created // by the Shell, and then the pointer on the original primitive will be passed // to the modeler thru the Import() call, just after Edit() has been called. // In that case, the modeler is supposed to get whatever data it can get, // and convert it into data for the empty primitive passed to Edit(). } SExModelerPrimitiveData; // Structure of the Cmpp resource: typedef struct { long fCanEditPatches; // TRUE if modeler can edit any patch based object long fCanEditFacets; // TRUE if modeler can edit any facet based object long fPrimitiveIDNb; // Number of primitive Class IDs in fPrimitiveIDList SExModelerPrimitiveData fPrimitiveList[1]; // List of primitive Class IDs } SExModelerData; /*****************************************************************************\ * Notes on the Planes Tool (for I3DExModeler::SetPlanesTool()) * * * * Theory: * * * * After I3DExModeler::Edit() is called, I3DExModeler::SetPlanesTool() is * * called to pass the Planes Tool pointer to the modeler. * * When the user clicks inside the planes tool, I3DExModeler::OnMenuAction()* * will be called with a specific action number (see constants below). * * You can also set and get the current status of the Planes Tool by using * * gViewManager->SetValues() and gViewManager->GetValues() using the * * constants below. * * * \*****************************************************************************/ //-- Action numbers: #define kPTChangePlanes 9460 #define kPTChangeActivePlane 9461 //-- GetValues/SetValues: , and // The 4 lower bits give the number of the Drawing plane #define kPTBotDrw 0x00000000L #define kPTRightDrw 0x00000001L #define kPTLeftDrw 0x00000002L // The 4 next bits give the status of each sub part. #define kPTBot 0x00000010L #define kPTRight 0x00000020L #define kPTLeft 0x00000040L #define kPTCube 0x00000080L /*****************************************************************************\ * I3DExModeler * * * * External Modelers interface * * * * * \*****************************************************************************/ #undef INTERFACE #define INTERFACE I3DExModeler DECLARE_INTERFACE_(I3DExModeler, I3DExModule) { // IUnknown methods STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE; STDMETHOD_(ULONG, AddRef) (THIS) PURE; STDMETHOD_(ULONG, Release) (THIS) PURE; // I3DExtension methods STDMETHOD(ShellUtilitiesInit) (THIS_ IShUtilities* shellUtilities) PURE; STDMETHOD_(I3DExtension*, Clone) (THIS) PURE; // I3DExDataExchanger methods STDMETHOD_(ExtensionDataMap*, GetExtensionDataMap) (THIS) PURE; // Return NULL if GetResID is to be used STDMETHOD_(void*, GetExtensionDataBuffer) (THIS) PURE; STDMETHOD(ExtensionDataChanged) (THIS) PURE; STDMETHOD(HandleEvent) (THIS_ ULONG sourceID) PURE; STDMETHOD_(short, GetResID) (THIS) PURE; // I3DExModule methods STDMETHOD(SetPrefs) (THIS_ void* prefs) PURE; // 'prefs' is a pointer given by the Shell on the Module's Preferences data block STDMETHOD(Edit) (THIS_ IUnknown* element) PURE; STDMETHOD(Import) (THIS_ IUnknown* element, void* parameters) PURE; STDMETHOD(PrepareMenus) (THIS) PURE; STDMETHOD_(BOOLEAN, OnMenuAction) (THIS_ IShContext* context, long actionNumber) PURE; STDMETHOD_(BOOLEAN, OnKeyEvent) (THIS_ IShContext* context, PLATFORMEVENT* event) PURE; STDMETHOD(OnToolAction) (THIS_ IShContext* context, short oldTool, short newTool) PURE; STDMETHOD(Activate) (THIS_ IShContext* context, BOOLEAN entering) PURE; STDMETHOD(Update) (THIS_ IShContext* context, I3DShScene* scene, long change) PURE; STDMETHOD(Do) (THIS_ IShContext* context, ULONG message, void* data, void** result) PURE; STDMETHOD_(BOOLEAN, LaunchToolDragAndDrop) (THIS_ short tool) PURE; STDMETHOD_(BOOLEAN, GetZoomEffect) (THIS_ void* prevElem, void* nextElem, Boolean* zoomIn) PURE; STDMETHOD_(BOOLEAN, PropertiesChanged) (THIS) PURE; // Return TRUE if GetPropertiesInfo() should be called to update the the Properties Palette STDMETHOD_(BOOLEAN, GetPropertiesInfo) (THIS_ short& viewAndPMapID, void*& dataBuffer, void*& privData, BOOLEAN& forceShowProperties, OnMessagePropsCallBack& onMessageCallBack, // The External Module should return its View callback here DrawNowPropsCallBack drawNowPropsCallBack, void* module) PURE; // The Shell is giving this callback so that the External Modeler can redraw the Properties view immediately STDMETHOD(DoApplyProperties) (THIS_ IShContext* context, IShView* topView, void* privData) PURE; STDMETHOD(DoRestoreProperties) (THIS_ IShContext* context, IShView* topView, void* privData) PURE; // I3DExModeler methods STDMETHOD(SetPlanesTool) (THIS_ IShControl* planesTool) PURE; // Called just after Edit(). The modeler can store this pointer in order to play with the Planes tool. See notes above STDMETHOD_(BOOLEAN, JumpOut) (THIS_ BOOLEAN regJumpOut) PURE; // Called when jumping out. 'regJumpOut' is TRUE if regular jump-out, FALSE if exiting thru the 'Restore' button. Should return TRUE if the hot point should be centered on the object's bbox // OperationDoneit(), OperationUndoneit(), OperationRedoneit(), OperationReleased() are used // so the Modeler can be made aware that a Modeler Operation has been undone, undone, redone // or disposed of. Use it to update any internal data (cache invalidation, etc.) // 'changedData' is what is returned by I3DExModelerOperation::Doit(), Undoit(), and Redoit() STDMETHOD(OperationDoneit) (THIS_ I3DExModelerOperation* modelerOperation, BOOLEAN changedData) PURE; STDMETHOD(OperationUndoneit) (THIS_ I3DExModelerOperation* modelerOperation, BOOLEAN changedData) PURE; STDMETHOD(OperationRedoneit) (THIS_ I3DExModelerOperation* modelerOperation, BOOLEAN changedData) PURE; STDMETHOD(OperationReleased) (THIS_ I3DExModelerOperation* modelerOperation) PURE; }; /*****************************************************************************\ * I3DExModelerOperation * * * * External commands for external modelers interface * * * Implements a convenient way to add commands to an external modeler by * adding menu items, toolbar buttons or Properties Palette actions. * * The ClassID of the Modeler to which the operation belongs is stored in the * Cmpp resource (see SExModelerOperationData below). * * Toolbar buttons: * If the operation is a toolbar button, then a icl8 icon resource of the * same ID should be provided. The "down" state of the button should also * be provided as a icl8 icon of ID+50. * Menu items: * The "SubFamily name" in the COMP resource is used to group operations in * a sub-menu of that name. Put an empty string to just have the operation added * directly in the menu. * Palette actions: * You need to have a sub view in your palette of type TView with a * "TModelerOperationList" Class Name and the (unique) 'XOpL' ID. * This view automatically takes care of the * list of Palette Modeler Operations for this modeler and handles * everything for you. This view should have a sub view of type "TPopupView" with * a 'MENU' ID (this is the pop-up menu containing the list of Operations), * and another sub view of type "TView" with a 'COVW' ID (this is where the * Operation UI will show up). If you want to have the name of the operation * shown automatically in a static text, set up a sub view of type TStaticText * with an 'NAME' ID (this is optional). * As usual, the top view of your Modeler Operation should be a TView of the * TComponentView class, but it MUST have an 'EDIT' ID. * * Note: since the Properties Palette can be in 'auto' mode, it is important * to have 'good' default values in your UI, because your operation will be * immediately launched after being chosen in the pop-up menu * * * * * \*****************************************************************************/ /*****************************************************************************\ * Private data of the operation (stored in the Cmpp resource of same ID). * \*****************************************************************************/ // Type of Modeler Operation: #define kShToolModelerOp 0 /* Toolbar button */ #define kShMenuModelerOp 1 /* Menu item */ #define kShPaletteModelerOp 2 /* Palette action */ typedef struct { long fModelerID; // Class ID of the modeler to which the operation belongs long fType; // kShToolModelerOp, kShMenuModelerOp, or kShPaletteModelerOp long fInsertAfter; // Rank after which the menu item or the tool should be inserted. -1 for the end. //-- If Menu type: long fSeparator; // TRUE if a 'separator' line should be inserted before the menu item long fTargetMenu; // Menu ID to which the operation should be added //-- If Toolbar button type: short fIconID; // ID of the icl8 resource. Selection icon is an icl8 resource of fIconID+50 short fToolKey; // Key stroke equivalent to the button long fActionNumber; // Unique identifier of the button //-- If Palette action type: /* no parameters */ } SExModelerOperationData; #undef INTERFACE #define INTERFACE I3DExModelerOperation DECLARE_INTERFACE_(I3DExModelerOperation, I3DExDataExchanger) { // IUnknown methods STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE; STDMETHOD_(ULONG, AddRef) (THIS) PURE; STDMETHOD_(ULONG, Release) (THIS) PURE; // I3DExtension methods STDMETHOD(ShellUtilitiesInit) (THIS_ IShUtilities* shellUtilities) PURE; STDMETHOD_(I3DExtension*, Clone) (THIS) PURE; // I3DExDataExchanger methods STDMETHOD_(ExtensionDataMap*, GetExtensionDataMap) (THIS) PURE; // Return NULL if GetResID is to be used STDMETHOD_(void*, GetExtensionDataBuffer) (THIS) PURE; STDMETHOD(ExtensionDataChanged) (THIS) PURE; STDMETHOD(HandleEvent) (THIS_ ULONG sourceID) PURE; STDMETHOD_(short, GetResID) (THIS) PURE; // I3DExModelerOperation methods STDMETHOD_(BOOLEAN, Enable) (THIS_ IUnknown* data) PURE; // Enable menu or tool ? STDMETHOD(SetModeler) (THIS_ IUnknown* modeler) PURE; // This gives a chance to do private chat with the modeler launching the operation STDMETHOD(Prepare) (THIS_ IUnknown* data, BOOLEAN* canUndo) PURE; // Called just before opening the dialog (if any) STDMETHOD_(BOOLEAN, DoIt) (THIS_ IUnknown* data) PURE; // Perform the operation. Return TRUE if data was changed. STDMETHOD_(BOOLEAN, UndoIt) (THIS_ IUnknown* data) PURE; // Undo the operation. Return TRUE if data was changed. STDMETHOD_(BOOLEAN, RedoIt) (THIS_ IUnknown* data) PURE; // Do it again. Return TRUE if data was changed. STDMETHOD_(BOOLEAN, ForceRedraw) (THIS_ IUnknown* data) PURE; // Should return TRUE if the view (if any) should be redrawn }; #endif